<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // charAt() 根据索引返回字符串
        let o = 'hyyydsjjjs'
        console.log(o.charAt(7));
        for (let i = 0; i < o.length; i++) {
            console.log(o.charAt(i));
        }
        // o.charCodeAt()返回字符集ASCII
        console.log(o.charCodeAt(0));

        // concat() 链接字符串
        let str = 'jskj'
        let a = str.concat('djhfdj')
        console.log(a);

        //substr不推荐使用，用下面这个效果一样
        // substring(起始位置，截取几个字符)，包前不包尾
        let s = '还我塔身，本尊复苏了'
        let a1 = s.substring(2, 4)
        console.log(a1);

        // replace(被替换的字符，替换为的字符) 如有多个相同字符只替换第一个
        let re = '诸位我已天下无敌'
        let a2 = re.replace('天', '地')
        console.log(a2);
        let res = 'sjafskfjjf'
        for (let i = 0; i < res.length; i++) {
            console.log(res.charAt(i));
            if (res.charAt(i) == 'j') {
                res = res.replace('j', '*')
            }
        }
        console.log(res);


        //  字符串装换数组 split('分隔符')  join('')数组转字符串
        let d = 'a,b,d,c,f'
        let f = d.split(',')
        console.log(f);
        let d1 = 'a&b&d&c&f'
        let f1 = d1.split('&')
        console.log(f1);



        console.log("===============startsWith('hh')================");
        //  判断是不是以某个字符开头 返回true或false
        let i = "hhb dafhfa"
        let pp = i.startsWith("hh")
        console.log(pp);

        console.log("======================includes()========================");
        // 判断里面是不是包含这个字符串 返回true或false
        let k = "hhb dafhfa"
        let p = k.includes("hh")
        console.log(p);
    </script>
</body>

</html>